package com.bobo.web.provider.util.wxUtils;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * yangbo
 * 2018-09-04
 * wxpay-sdk
 **/
@Component
public class MyConfig implements WXPayConfig {
    private byte[] certData;
    @Value("${basketball.wechat.appid}")
    private String appID;
    @Value("${basketball.wechat.mchid}")
    private String mchID;
    /**
     * 微信支付使用到到API密钥
     */
    @Value("${basketball.wechat.key}")
    private String key;
    public MyConfig() throws Exception {
        this.appID="wxcc01499f73dbab9e";
        this.mchID="1521609461";
        this.key="f45c13ac22304c5e98aba3f887f776bb";
    }
    public String getAppID() {
        return "wxcc01499f73dbab9e";
    }

    public String getMchID() {
        return "1521609461";
    }

    public String getKey() {
        return "f45c13ac22304c5e98aba3f887f776bb";
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

}
